#pragma once

#include <iostream>
#include <unordered_map>
#include <vector>
#include <raylib.h>
#include "Position.hpp"
#include "Color.hpp"

class Block
{
    using VectorPosition = std::vector<Position>;
public:
    Block(int id,int cellSize);

    void draw(int offsetx,int offsety);//绘制方块

    VectorPosition GetBlockPosition();

    unsigned int GetId();

    void move(int row,int col);//移动方块

    void rotate();//翻转

    void UndoRotate();//撤销翻转
protected:
    int _id;//存储方块的id，可与匹配对应的颜色
    std::unordered_map<int,VectorPosition> _shapes;//翻转系数对应形状
private:
    int _rotation;//翻转系数
    int _cellSize;//大小
    int _RowOffset;//横坐标偏移量
    int _ColOffset;//纵坐标偏移量
};
